function MovementInfo_Code() {
	var buffer = new StringBuffer();
	buffer.append('<div id="purchaseinfo" class="orderinfo" type="1"><div class="line100"><font class="blacks">调拨单号：</font><font id="movementnum">加载中...</font></div><div class="line100"><font class="blacks">总金额：</font><font id="allmoney"></font></div><div class="line100"><font class="blacks">创建人：</font><font id="realname"></font></div><div class="line100"><font class="blacks">调拨时间：</font><font id="movedate"></font></div><div class="line100"><font class="blacks">调出仓库：</font><font id="fromlibraryid"></font></div><div class="line100"><font class="blacks">调入仓库：</font><font id="tolibraryid"></font></div><div class="line100"><font class="blacks">备注：</font><font id="bak"></font></div></div>');
	
	buffer.append('<div class="ordertab border-top-bottom"><table><tr><td width="40%">产品名称</td><td width="10%">单位</td><td width="20%">价格</td><td width="10%">数量</td><td width="20%">总金额</td></tr></table></div>');
	buffer.append('<div class="productpanel">');
	buffer.append('<div class="panels"><div id="loading10"><img src="img/loading.gif"/></div></div>');
	buffer.append('</div>');
	return buffer.toString();
};



function Init_MovementDetail(){
	
	var data = {};
    data.act = "One_Movement";
    data.id = obj.attr("id");
    data.userid=userid;
	data.comid=comid;
	data.source=source;
	data.sign=GetSign(data.act);
    mui.getJSON(crm_domain, data, function(json) {
    	var movement = json.data.movement;
    	var str="";
    	var isselect="";
        $("#movementnum").html(movement.Num);
        $("#allmoney").html(movement.AllMoney.toFixed(2));
        $("#realname").html(movement.RealName);
        $("#movedate").html(movement.MoveDate.ToTime());
        $("#fromlibraryid").html(movement.FromLibraryName);
        $("#tolibraryid").html(movement.ToLibraryName);
        $("#bak").html(movement.Bak.ToString());
        //初始化拓展字段
        //Init_ExpandTags(tags);
        $(".panels").html(Movement_Info_Data1(json.data.movementdetail));
    });
};

function Movement_Info_Data1(data) { 
var buffer = new StringBuffer();
$.each(data,function(i,info){
buffer.append('<table><tr>');
buffer.append('<td width="40%">'+info.ProductName+'</td>');
buffer.append('<td width="10%">'+info.Unit+'</td>');
buffer.append('<td width="20%">'+info.CostPrice.toFixed(2)+'</td>');
buffer.append('<td width="10%">'+info.Count+'</td>');
buffer.append('<td width="20%">'+info.AllMoney.toFixed(2)+'</td>');
buffer.append('</tr></table>');
});
if(data.length==0){
buffer.append('<tr><td class="center">主人，没有找到您需要的数据！</td></tr>');
}
return buffer.toString();
};

function MovementTool()
{
	if($("#movementinfotool").length>0)
	{
		$("#movementinfotool").show();
	}else
	{
		$("body").append('<div id="movementinfotool" class="customertool" style="height:120px;"><ul><li id="movementedit">修改调拨单</li><li id="movementdelete" class="hidden">删除调拨单</li></ul></div>');
		//初始化工具条
		
        
		get("movementedit").addEventListener("tap",function(){
        	OpenWindow(3,"调拨单","保存",function(){
				Save_Movement();
			});
			$("#contentlist3").html(MovementAdd_Code(obj.attr("id")));
			Init_MovementAdd();
			$("#movementinfotool").hide();
        });
        
        get("movementdelete").addEventListener("tap",function(){
        	$("#movementinfotool").hide();
        	plus.nativeUI.confirm("确定要删除吗？", function(event){
				if(event.index==1)
				{
					var data = {};
				    data.act = "Delete_Purchase";
				    data.ids = obj.attr("id");
				    data.userid=userid;
					data.comid=comid;
					data.source=source;
					data.sign=GetSign(data.act);
				    mui.getJSON(crm_domain, data, function(json) {
				    	plus.nativeUI.toast(json.msg);
						if(json.state)
						{
							CloseWindow();
							obj.remove();
						}
				    });	
				}
			},"提示", ["取消","确认"]); 
        });
	}
};
